<div class="modal fade " id="addCustdatafileModal"   role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document" style="width: 60%">
        <div class="box box-info">
            <div class="box-header with-border">
                <h3 class="box-title">客户数据任务配置</h3>
            </div>
            <!-- /.box-header -->
            <!-- form start -->
            <form class="form-horizontal" id="addExchangeInfoForm">
                <div class="box-body">
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label">任务名称</label>
                        <div class="col-sm-7">
                            <input id="addCustdatafileModal_taskName" type="text" class="form-control">
                            <input id="addCustdatafileModal_id" type="hidden" >
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label">任务类型</label>
                        <div class="col-sm-7">
                            <select id="addCustdatafileModal_type" class="select2" style="width: 100px">
                                <option value="1">晚间清算</option>
                                <option value="2">客户服务</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label">客户名称</label>
                        <div class="col-sm-7">
                            <input id="addCustdatafileModal_custName" type="text" class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label">目的类型</label>
                        <div class="col-sm-7">
                            <select id="addCustdatafileModal_destType" class="select2" style="width: 100px">
                                <option value="1">邮件</option>
                                <option value="2">深圳通</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label">目的地址</label>
                        <div class="col-sm-7">
                            <textarea id="addCustdatafileModal_destAddress" class="form-control" rows="4"  >
                                 </textarea>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label">JSON参数</label>
                        <div class="col-sm-7">
                            <textarea id="addCustdatafileModal_jsonProperties" class="form-control" rows="4"  placeholder="JSON参数">
                                 </textarea>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label">开始时间</label>
                        <div class="col-sm-7">
                            <input id="addCustdatafileModal_beginTime" type="text" class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label">下次执行日期</label>
                        <div class="col-sm-7">
                            <input id="addCustdatafileModal_nextDate" type="text" class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label">业务方</label>
                        <div class="col-sm-7">
                            <input id="addCustdatafileModal_businSider" type="text" class="form-control">
                        </div>
                    </div>
                </div>
                <!-- /.box-body -->
                <div class="box-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal"  >取消</button>

                    <button type="button" class="btn btn-primary pull-right" onclick="addCustdatafileModal_save()">保存</button>
                </div>
                <!-- /.box-footer -->
            </form>
        </div>
    </div>
</div>
<script>
    $(".select2").select2();

    function addCustdatafileModal_init() {
        $("#addCustdatafileModal_taskName").val("");
        $("#addCustdatafileModal_id").val("");
        $("#addCustdatafileModal_type").val("");
        $("#addCustdatafileModal_custName").val("");
        $("#addCustdatafileModal_destType").val("");
        $("#addCustdatafileModal_destAddress").val("");
        $("#addCustdatafileModal_jsonProperties").val("");
        $("#addCustdatafileModal_beginTime").val("");
        $("#addCustdatafileModal_nextDate").val("");
        $("#addCustdatafileModal_businSider").val("");

    }

    function addCustdatafileModal_setValue(index) {
        var data = $("#table1").bootstrapTable("getData")[index] ;
        $("#addCustdatafileModal_taskName").val(data.taskName);
        $("#addCustdatafileModal_id").val(data.id);
        $("#addCustdatafileModal_type").val(data.type);
        $("#addCustdatafileModal_custName").val(data.custName);
        $("#addCustdatafileModal_destType").val(data.destType);
        $("#addCustdatafileModal_destAddress").val(data.destAddress);
        $("#addCustdatafileModal_jsonProperties").val(data.jsonProperties);
        $("#addCustdatafileModal_beginTime").val(data.beginTime);
        $("#addCustdatafileModal_nextDate").val(data.nextDate);
        $("#addCustdatafileModal_businSider").val(data.businSider);
    }

    function addCustdatafileModal_save() {
        var data = {
            taskName:$("#addCustdatafileModal_taskName").val(),
            id:$("#addCustdatafileModal_id").val(),
            type:$("#addCustdatafileModal_type").val(),
            custName:$("#addCustdatafileModal_custName").val(),
            destType:$("#addCustdatafileModal_destType").val(),
            destAddress:$("#addCustdatafileModal_destAddress").val(),
            jsonProperties:$("#addCustdatafileModal_jsonProperties").val(),
            beginTime:$("#addCustdatafileModal_beginTime").val(),
            nextDate:$("#addCustdatafileModal_nextDate").val(),
            businSider:$("#addCustdatafileModal_businSider").val()
        };
        var url = "/exccustomer/save" ;
        postReq(url,data,function(result){
            if (result.success) {
                toastr['success']('操作成功', '提示');
                $("#table1").bootstrapTable("refresh");
                $("#addCustdatafileModal").modal("hide");
            } else {
                toastr['error'](result.msg, '提示');
            }
        }) ;

    }
</script>